<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<ui:composition template="../template/layout.xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	<ui:param name="pageHeaderTitle" value="Doctor list" />
	<ui:param name="pageTitle" value="Doctor list" />
	<ui:define name="content">
		<div id="inner_content">
		<h:form>
			<p:outputLabel value="Doctor specialty: " for="selectSpecialty" />
			<br />		
						
			<p:selectOneMenu id="selectSpecialty" panelStyle="width:150px"
							style="width:160px" value="#{findDoctorBean.selectedSpec}">				
				<f:selectItems value="#{findDoctorBean.doctorSpecialtyList}" />
				<p:ajax event="change" listener="#{findDoctorBean.getDoctorListBySpecialty}" update=":resultGroup" />
			</p:selectOneMenu>
																												
		</h:form>
			<br />			
			<br />
			<h:panelGroup id="resultGroup">
				<p:dataTable id="findDoctorResultTable" style="width:650px" var="doctor" value="#{findDoctorBean.resultList}" paginator="true" rows="10" paginatorAlwaysVisible="false" 
		                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" paginatorPosition="bottom" pageLinks="5" selectionMode="single" rowKey="#{doctor.id}">
		            <p:ajax event="rowSelect" listener="#{findDoctorBean.onRowSelect}" />
					<p:column headerText="Doctor name">
						<h:outputText value="#{doctor.firstName} #{doctor.lastName}" />
					</p:column>
					<p:column headerText="Doctor specialty">
						<h:outputText value="#{doctor.spec}" />
					</p:column>
				</p:dataTable>
			</h:panelGroup>	
		</div>		
	</ui:define>
</ui:composition>
</html>